package com.gin.ehdownloader.controller;

import com.gin.ehdownloader.service.EhService;
import io.swagger.v3.oas.annotations.Operation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.io.IOException;

/**
 * @author : ginstone
 * @version : v1.0.0
 * @since : 2023/3/31 12:11
 */
@RestController
@RequiredArgsConstructor
@RequestMapping("eh")
public class EhController {

    private final EhService ehService;


    @PostMapping("add")
    @Operation(summary = "添加任务队列")
    public void postAdd(@RequestParam String url, @RequestParam(required = false) String range) throws IOException, InterruptedException {
        // 序号
        ehService.addTask(url, range);
    }
}   
